﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace iPhotoUploader.GUI
{
    public partial class Category : Form
    {
        public Guid ParentId { get; set; }

        public Category()
        {
            InitializeComponent();
        }

        private void Category_Load(object sender, EventArgs e)
        {
            
        }

        private void btnName_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtCategoryName.Text))
            {
                activeexposure.iPhoto active = new activeexposure.iPhoto();

                if(ParentId == null)
                    active.SaveCategory(txtCategoryName.Text);
                else
                    active.SaveSubCategory(ParentId, txtCategoryName.Text);

                ((CreateEventForm)Application.OpenForms["CreateEventForm"]).RefreshCategories();

                this.Close();
            }
        }
    }
}
